import Vue from 'vue'
import App from './App'

// vuex
import store from './store'

// 引入全局uView
import uView from '@/uni_modules/uview-ui'

import mixin from './common/mixin'
import imgInfo from '@/components/ImgInfo.vue'
import pageHeader from '@/components/pageHeader.vue'
import service from  './common/service'
Vue.component('pageHeader',pageHeader)
Vue.component('imgInfo',imgInfo)
Vue.prototype.$store = store
Vue.prototype.service = service
Vue.config.productionTip = false

App.mpType = 'app'
Vue.use(uView)

Vue.prototype.item = { 
	name:"测试",
	desc:"测试测试", 
	img:'/static/image.png',
age:10, money:100 }
Vue.prototype.list = Array(10).fill(Vue.prototype.item)

Vue.prototype.toPage = function(url) {
	console.log(1,url)
	uni.navigateTo({
		url: url,
	});
};

Vue.prototype.msg = function(title, icon = "none") {
	if (!title) return;
	uni.showToast({
		title,
		icon
	});
};

Vue.prototype.back = function(delta = 1, time = 0) {
	setTimeout(() => {
		uni.navigateBack({
			delta
		})
	}, time)
};
// #ifdef MP
// 引入uView对小程序分享的mixin封装
const mpShare = require('@/uni_modules/uview-ui/libs/mixin/mpShare.js')
Vue.mixin(mpShare)
// #endif

Vue.mixin(mixin)

const app = new Vue({
    store,
    ...App
})

// 引入请求封装
require('./util/request/index')(app)

app.$mount()
